30 #include <libaccounts-glib.h>
32 using namespace Accounts;
52 if (m_service !=
nullptr && mode == AddReference)
53 ag_service_ref(m_service);
70 m_service(other.m_service),
73 if (m_service !=
nullptr)
74 ag_service_ref(m_service);
79 if (m_service == other.m_service)
return *
this;
80 if (m_service !=
nullptr)
81 ag_service_unref(m_service);
82 m_service = other.m_service;
83 if (m_service !=
nullptr)
84 ag_service_ref(m_service);
90 if (m_service !=
nullptr) {
91 ag_service_unref(m_service);
94 if (m_tags !=
nullptr) {
106 return m_service !=
nullptr;
116 if (Q_UNLIKELY(!
isValid()))
return QString();
117 return UTF8(ag_service_get_name(m_service));
126 return UTF8(ag_service_get_description(m_service));
135 return UTF8(ag_service_get_display_name(m_service));
144 return ASCII(ag_service_get_service_type(m_service));
152 return ASCII(ag_service_get_i18n_domain(m_service));
161 return UTF8(ag_service_get_provider(m_service));
170 return ASCII(ag_service_get_icon_name(m_service));
182 return ag_service_has_tag(m_service, tag.toUtf8().constData());
195 m_tags =
new QSet<QString>;
196 GList *list = ag_service_get_tags(m_service);
198 while (iter != NULL) {
199 m_tags->insert(UTF8(
reinterpret_cast<const gchar *
> (iter->data)));
200 iter = g_list_next(iter);
214 ag_service_get_file_contents(m_service, &data, NULL);
220 if (!doc.setContent(QByteArray(data),
true,
221 &errorStr, &errorLine, &errorColumn))
223 QString message(QStringLiteral(
"Parse error reading account service file "
224 "at line %1, column %2:\n%3"));
225 message = message.arg(errorLine).arg(errorColumn).arg(errorStr);
226 qWarning() << __PRETTY_FUNCTION__ << message;
231 AgService *Service::service()
const
Representation of an account service.
QSet< QString > tags() const
Return all tags of the service as a set.
Service()
Construct an invalid service.
QString serviceType() const
Get the service type ID of the service.
bool isValid() const
Check whether this object represents a Service.
QString name() const
Get the name of the service.
QString iconName() const
Get the icon name for this service.
QString displayName() const
Get the display name of the service, untranslated.
QString description() const
Get the description of the service.
QString provider() const
Get the provider ID of the service.
bool hasTag(const QString &tag) const
Check if this service has a tag.
QString trCatalog() const
const QDomDocument domDocument() const
Get the contents of the service XML file.